/*
 * Copyright (C) 2015-2020, Wazuh Inc.
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General Public
 * License (version 2) as published by the FSF - Free Software
 * Foundation.
 */

#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <stdio.h>
#include <string.h>

#include "../../wrappers/common.h"
#include "../../wrappers/wazuh/shared/string_op_wrappers.h"
#include "../../wazuh_modules/wmodules.h"
#include "../../headers/shared.h"
#include "../../wazuh_modules/vulnerability_detector/mocks_wm_vuln_detector.h"

/* redefinitons/wrapping */


int __wrap_wurl_request_uncompress_bz2_gz(const char * url, const char * dest, const char * header, const char * data, const long timeout) {
    if (url) check_expected(url);
    if (dest) check_expected(dest);
    if (header) check_expected(header);
    if (data) check_expected(data);
    if (timeout) check_expected(timeout);
    return mock();
}

int __wrap_w_uncompress_bz2_gz_file(const char * path, const char * dest) {
    if (path) check_expected(path);
    if (dest) check_expected(dest);
    return mock();
}

// wm_vuln_detector mocks

int __wrap_OS_ReadXML(const char *file, OS_XML *_lxml) {
    return mock();
}

xml_node **__wrap_OS_GetElementsbyNode(const OS_XML *_lxml, const xml_node *node) {
    return mock_type(xml_node **);
}

char * __wrap_w_get_file_content(const char * path, int max_size) {
    return mock_type(char *);
}

// wm_vuln_detector_evr mocks

time_t __wrap_time(time_t *t) {
    return mock_type(time_t);
}

struct tm *__wrap_localtime(const time_t *t) {
    return mock_type(struct tm *);
}
